#ifndef LINEPLOTTER_H
#define LINEPLOTTER_H

#include <vector>

class vtkLookupTable;
class vtkPoints;
class vtkCellArray;
class vtkFloatArray;
class vtkActor;
class vtkPolyData;

/*
	This code greatly resembles the one from "MyVTKLinePlotter" , only here there's an optimization for the number of points defined.
	The actual number of points stored in the original one is twice the one stored in here.
*/

struct Segment
{
	float point[3];
	float scalar;
};

class LinePlotter
{
public:

	LinePlotter();
	~LinePlotter();

	void SetScalarRange(double minval=0.0, double maxval=1.0);

	void SetAllLineWidth(int width = 1);

	/*
		This method was changed so that it requires only half the amount of data of the original LinePlotter example.
		For each segment of a continueous line all inner points were stored twice : once for the first and once for the second line segment.
		Here a continueous line can be entered and each inner point serves 2 segments, thus requiring only half the amount of data.
	*/
	void PlotLine(std::vector<Segment>&);
	
	vtkActor* CreateActor(); 
	vtkPolyData* CreatePolyData();
private:

	double m_scalarMin, m_scalarMax ;
	int m_curPointID ;
	int m_allLineWidth ;

	vtkPoints* m_points;
	vtkCellArray* m_lines;
	vtkFloatArray* m_lineScalars ;
};

#endif
